package com.cy.pj.sys.dao;

import com.cy.pj.sys.pojo.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Set;

@Mapper
public interface SysUserDao {
    @Update("update sys_users set password=#{newPassword},salt=#{newSalt} where id=#{userId}")
    int updatePassword(String newPassword,String newSalt,Integer userId);

    @Select("select * from sys_users where username=#{username}")
    SysUser selectUserByUsername(String username);

    List<SysUser> selectUsers(SysUser entity);

    @Update("update sys_users set valid=#{valid},modifiedTime=now(),modifiedUser=#{modifiedUser} where id=#{id}")
    int validById(Integer id,Integer valid,String modifiedUser);

    int insertUser(SysUser entity);

    SysUser selectById(Integer id);

    int updateUser(SysUser entity);

    Set<String> selectUserPermissions(Integer userId);
}
